/**
 * global
 */

 layui.define(['layer', 'jquery','element','util'], function(exports){
    var $ = layui.jquery
    ,layer = layui.layer
    ,util = layui.util,
    elem=layui.element;
  
    //固定Bar
    util.fixbar({
      showHeight: 60
      ,css: function(){
        if(global.pageType === 'demo'){
          return {bottom: 75}
        }
      }()
    });

      //窗口scroll
  (function(){
    var main = $('.site-menu'), scroll = function(){
      var stop = $(window).scrollTop();
      if($(window).width() <= 992) return;
      if(stop > 60){ //211
        if(!main.hasClass('site-fix')){
          main.addClass('site-fix').css({
            width: main.parent().width()
          });
        }
      }else {     
        if(main.hasClass('site-fix')){
          main.removeClass('site-fix').css({
            width: 'auto'
          });
        }
      }
      stop = null;
    };
    scroll();
    $(window).on('scroll', scroll);
  })();
    
    //手机设备的简单适配
    var treeMobile = $('.site-tree-mobile')
    ,shadeMobile = $('.site-mobile-shade')
  
    treeMobile.on('click', function(){
      $('body').addClass('site-mobile');
    });
  
    shadeMobile.on('click', function(){
      $('body').removeClass('site-mobile');
    });
  
  
    exports('global', '');
  });